/**
 * Implementacion de la clase Node.
 */

#include "edge.hpp"
#include "node.hpp"


	Node::Node(){

	}

	Node::Node(std::string id, float positionX, float positionY){
		this->id = id;
		this->positionX = positionX;
		this->positionY = positionY;
		this->minimunPathEdge = NULL;
		this->temporalWeight = -1;
	}

	std::string Node::getId(){
		return this->id;
	}

	List<Edge>* Node::getEdgeList(){
		return &(this->edgeList);
	}

	float Node::getPositionX(){
		return this->positionX;
	}

	float Node::getPositionY(){
		return this->positionY;
	}

	void Node::setId(std::string id){
		this->id = id;
	}

	void Node::setEdgeList(List<Edge> edgeList){
		this->edgeList = edgeList;
	}

	void Node::setPositionX(float positionX){
		this->positionX = positionX;
	}

	void Node::setPositionY(float positionY){
		this->positionY = positionY;
	}

     void Node::addEgde(Edge *edge){
        this->edgeList.add(edge);
    }

    bool Node::hasSamePosition(Node *newNode){
        if (this->positionX == newNode->getPositionX() && this->positionY == newNode->getPositionY())
            return true;
        return false;
    }

	Node& Node::operator=(Node &original){
		this->id = original.getId();
        //this->edgeList = original.getEdgeList();
		this->positionX = original.getPositionX();
		this->positionY = original.getPositionY();
		return *this;
	}

    int Node::operator==(Node &original) const{
        return (this->id == original.getId());
    }

    int Node::operator!=(Node &original) const{
        return (this->id == original.getId());
    }

    int Node::operator<(Node &original) const{
        return (this->temporalWeight < original.getTemporalWeight());
    }

    int Node::operator>(Node &original) const{
        return (this->temporalWeight > original.getTemporalWeight());
    }

    int Node::operator<=(Node &original) const{
        return (this->id <= original.getId());
    }

    int Node::operator>=(Node &original) const{
        return (this->id >= original.getId());
    }

	NodeIterator Node::iterator(){
		NodeIterator it(&(this->edgeList));
		return it;
	}


	Node::~Node(){
	}

	Edge* Node::getMinimunPathEdge(){
		return this->minimunPathEdge;
	}

	void Node::setMinimunPathEdge(Edge *mpe){
		this->minimunPathEdge = mpe;
	}

	float Node::getTemporalWeight(){
		return this->temporalWeight;
	}

	void Node::setTemporalWeight(float tw){
		this->temporalWeight = tw;
	}
